<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>注册页面</h1>
<form action="">
    <!--@blur时vue框架添加事件的方式 等效onblur-->
    <input type="text" name="username" @blur="blurfn()" placeholder="用户名">
    <span>{{info}}</span><br>
    <input type="text" name="password" placeholder="密码"><br>
    <input type="text" name="nick" placeholder="昵称"><br>
    <input type="text" name="age" placeholder="年龄"><br>
    <input type="button" value="注册">
</form>
<!--引入Vue-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<!--引入Axios-->
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
    let vm = new Vue({
        el: "form",
        data: {
            info: ""
        },
        methods:{
            blurfn:function () {
                //alert("编辑完成!");
                let data = new FormData(document.querySelector("form"))
                axiox.post("/check",data).then(function (response) {
                    //把服务器返回的数值给到info变量 页面会自动改变
                    vm.info = response.data;

                })
            }
        }
    })
</script>
</body>
</html>